using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace ConsoleApplication2.Models.Mapping
{
    public class PriceLstMap : EntityTypeConfiguration<PriceLst>
    {
        public PriceLstMap()
        {
            // Primary Key
            this.HasKey(t => t.ID);

            // Properties
            this.Property(t => t.NAME)
                .IsRequired()
                .HasMaxLength(50);

            this.Property(t => t.File_Primary_Key)
                .HasMaxLength(10);

            // Table & Column Mappings
            this.ToTable("PriceLst");
            this.Property(t => t.ID).HasColumnName("ID");
            this.Property(t => t.NAME).HasColumnName("NAME");
            this.Property(t => t.CURRENCY).HasColumnName("CURRENCY");
            this.Property(t => t.K).HasColumnName("K");
            this.Property(t => t.ARE).HasColumnName("ARE");
            this.Property(t => t.L).HasColumnName("L");
            this.Property(t => t.R).HasColumnName("R");
            this.Property(t => t.OR).HasColumnName("OR");
            this.Property(t => t.A).HasColumnName("A");
            this.Property(t => t.N).HasColumnName("N");
            this.Property(t => t.File_Primary_Key).HasColumnName("File Primary Key");
            this.Property(t => t.HOSPITAL).HasColumnName("HOSPITAL");
            this.Property(t => t.CONSULTATION).HasColumnName("CONSULTATION");
            this.Property(t => t.Basic).HasColumnName("Basic");
            this.Property(t => t.Percentage).HasColumnName("Percentage");
            this.Property(t => t.BasicListId).HasColumnName("BasicListId");
            this.Property(t => t.App).HasColumnName("App");
            this.Property(t => t.PL_Discount).HasColumnName("PL_Discount");

            // Relationships
            this.HasOptional(t => t.PriceLst2)
                .WithMany(t => t.PriceLst1)
                .HasForeignKey(d => d.BasicListId);

        }
    }
}
